package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("开始");

        try{
//            String line = null;
//            String line = "";

            String line = "abc";
            System.out.println(line.length());
            System.out.println(line.charAt(0));
            System.out.println(Integer.parseInt(line));

        }catch (NullPointerException | StringIndexOutOfBoundsException |NumberFormatException e){
            System.out.println("空指针、数据格式和下标越界异常统一处理");
        }catch(Exception e ){
            System.out.println("....");
        }
//        catch (NullPointerException e){
//            System.out.println("空指针异常");
//        }catch (StringIndexOutOfBoundsException e){
//            System.out.println("下标越界");
//        }

        System.out.println("结束");
    }
}
